#include <stdio.h>
#define MAX 120

void trans_to_num(char s[],int num[])
{
	int length=strlen(s);	
	int i;
	for(i=0;i<length;i++)	num[i]=s[length-1-i] - '0';
}


void bign_plus(int a[], int b[], int res[]){
	int i,t;
	int length=MAX-1;
	for(i=0;i<length;i++){
		t=a[i]+b[i];
		res[i+1]+=t/10;res[i]=t%10;
	}
	res[length]=res[length-1]/10;res[length-1]=res[length-1]%10;
}

void output_bign(int res[])
{
	int i;
	for(i=MAX-1;i>=0&&!res[i];i--);
	if(i==-1)	printf("0");
	for(;i>=0;i--)	printf("%d",res[i]);
}

int main(){
	
	char s[MAX]="";	
	int num[MAX]={};	
	int sum[MAX]={};	
	
	while(1){
	
		scanf("%s",s);
		
	
		if(s[0]=='0' && s[1]==0)	break;
		else{
		
		trans_to_num(s,num);
		
		
		bign_plus(sum,num,sum);
		}
	}
	
	output_bign(sum);
	
	return 0;
}
